import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../../model/config.dart';
class UserListItem extends StatelessWidget {
  Map msgUser;
  Function onClick;
  UserListItem({
    Key key,
    @required this.msgUser,
    this.onClick
  }):super(key:key);
  @override
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        height: ScreenUtil().setWidth(130),
        child: Row(
          children: <Widget>[
            Container(
              margin: EdgeInsets.all(ScreenUtil().setWidth(22)),
              width: ScreenUtil().setWidth(86),
              height: ScreenUtil().setWidth(86),
              decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(50),
                image: DecorationImage(
                  image: NetworkImage(
                    msgUser['headimgurl']
                  )
                )
              ),
            ),
            Expanded(
              child: Text(
                msgUser['name'] != null ? '${msgUser['nickname']}(${msgUser['name']})' : '${msgUser['nickname']}',
                style: TextStyle(
                  fontSize: ScreenUtil().setWidth(32),
                  color: Color.fromRGBO(3, 3, 3, 1),
                  fontWeight: FontWeight.w500
                ),
              ),
            )
          ],
        ),
      ),
      onTap: onClick,
    );
  }
}